package com.herenit.beijing.dh2011.entity;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table(name = "ET_CONCEPTS")
@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)
public class EtConcepts implements Serializable {

	private static final long serialVersionUID = 1L;
	@TableGenerator(
			name = "idGenerator", 
			table = "ET_Id_Generator", 
			pkColumnName = "pkColumn",
			valueColumnName = "valueColumn",
			pkColumnValue = "Concept_Id",
			allocationSize = 100,
			initialValue = 99854
			)
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "idGenerator")
	private long id;
	
	@Column(name = "CONCEPT_CODE")
	private String conceptCode;
	
	@Column(name = "CONCEPT_NAME")
	private String conceptName;
	
	@Column(name = "RETIRED_DATE")
	private Timestamp retiredDate;
	
	@Column(name = "STATUS_CODE")
	private String statusCode;
	
	@Column(name = "CREATION_DATE")
	private Timestamp creationDate;
        
	@Column(name = "CREATED_BY")
	private Long createdBy;
	
	@Column(name = "CREATED_BY_NAME")
	private String createdByName;
	
	@Column(name = "LAST_UPDATE_DATE")
	private Timestamp lastUpdateDate;
	
	@Column(name = "LAST_UPDATED_BY")
	private Long lastUpdatedBy;
	
	@Column(name = "LAST_UPDATED_BY_NAME")
	private String lastUpdatedByName;

	//五笔
	@Column(name = "INPUT_PY")
	private String inputPy;
	
	@Column(name = "INPUT_WB")
	private String inputWb;

	@OneToMany(mappedBy = "parents",fetch=FetchType.LAZY)
	private List<EtConcepts> children;

	@ManyToOne
	@JoinColumn(name = "PARENT_ID")
	private EtConcepts parents;

	@ManyToOne
	@JoinColumn(name = "VERSION_ID")
	private EtVersions etVersions;

	public EtConcepts() {
		Long i = new Long(1);
		Timestamp nowTime = new Timestamp(new Date().getTime());

		createdBy = i;
		creationDate = nowTime;
		lastUpdatedBy = i;
		lastUpdateDate = nowTime;
		
	}

    public List<EtConcepts> getChildren() {
        return children;
    }

    public void setChildren(List<EtConcepts> children) {
        this.children = children;
    }

    
   
    public String getConceptCode() {
        return conceptCode;
    }

    public void setConceptCode(String conceptCode) {
        this.conceptCode = conceptCode;
    }

    public String getConceptName() {
        return conceptName;
    }

    public void setConceptName(String conceptName) {
        this.conceptName = conceptName;
    }

    public Long getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(Long createdBy) {
        this.createdBy = createdBy;
    }

    public String getCreatedByName() {
        return createdByName;
    }

    public void setCreatedByName(String createdByName) {
        this.createdByName = createdByName;
    }

    public Timestamp getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Timestamp creationDate) {
        this.creationDate = creationDate;
    }

    public EtVersions getEtVersions() {
        return etVersions;
    }

    public void setEtVersions(EtVersions etVersions) {
        this.etVersions = etVersions;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getInputPy() {
        return inputPy;
    }

    public void setInputPy(String inputPy) {
        this.inputPy = inputPy;
    }

    public String getInputWb() {
        return inputWb;
    }

    public void setInputWb(String inputWb) {
        this.inputWb = inputWb;
    }

    public Timestamp getLastUpdateDate() {
        return lastUpdateDate;
    }

    public void setLastUpdateDate(Timestamp lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }

    public Long getLastUpdatedBy() {
        return lastUpdatedBy;
    }

    public void setLastUpdatedBy(Long lastUpdatedBy) {
        this.lastUpdatedBy = lastUpdatedBy;
    }

    public String getLastUpdatedByName() {
        return lastUpdatedByName;
    }

    public void setLastUpdatedByName(String lastUpdatedByName) {
        this.lastUpdatedByName = lastUpdatedByName;
    }

    public EtConcepts getParents() {
        return parents;
    }

    public void setParents(EtConcepts parents) {
        this.parents = parents;
    }

    public Timestamp getRetiredDate() {
        return retiredDate;
    }

    public void setRetiredDate(Timestamp retiredDate) {
        this.retiredDate = retiredDate;
    }

    public String getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(String statusCode) {
        this.statusCode = statusCode;
    }

        
	
}
